﻿using System.ComponentModel;
using System;
using System.Collections.Generic;
using Castle.ActiveRecord;
using MyMovieCollection.DATA.Models.Converter;

namespace MyMovieCollection.DATA.Models
{
    [TypeConverter(typeof(ARConverter<MovieType>))]
    [ActiveRecord]
    public class MovieType:ActiveRecordBase<MovieType>
    {
        [PrimaryKey(PrimaryKeyType.Increment)]
        public int ID { get; set; }
        [Property]
        public string TypeName { get; set; }
        public MovieType()
        {
        }

        public MovieType(int p_ID, string p_TypeName)
        {
            ID = p_ID;
            TypeName = p_TypeName;
        }
        internal class NameComparerAscHelper : IComparer<MovieType>
        {
            public int Compare(MovieType x, MovieType y)
            {
                return String.Compare(x.TypeName, y.TypeName);
            }
        }

        public static IComparer<MovieType> NameComparerAsc()
        {
            return new NameComparerAscHelper();
        }
    }

}
